home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Interfaces / CIncludes / Editions.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-11  |  14.7 KB  |  413 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Editions.h
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a3  ETO #16, MPW prerelease.  Friday, November 11, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. */
  16.  
  17. #ifndef __EDITIONS__
  18. #define __EDITIONS__
  19.  
  20.  
  21. #ifndef __MEMORY__
  22. #include <Memory.h>
  23. #endif
  24. /*    #include <Types.h>                                            */
  25. /*        #include <ConditionalMacros.h>                            */
  26. /*    #include <MixedMode.h>                                        */
  27.  
  28. #ifndef __FILES__
  29. #include <Files.h>
  30. #endif
  31. /*    #include <OSUtils.h>                                        */
  32.  
  33. #ifndef __ALIASES__
  34. #include <Aliases.h>
  35. #endif
  36. /*    #include <AppleTalk.h>                                        */
  37.  
  38. #ifndef __DIALOGS__
  39. #include <Dialogs.h>
  40. #endif
  41. /*    #include <Errors.h>                                            */
  42. /*    #include <Windows.h>                                        */
  43. /*        #include <Quickdraw.h>                                    */
  44. /*            #include <QuickdrawText.h>                            */
  45. /*        #include <Events.h>                                        */
  46. /*        #include <Controls.h>                                    */
  47. /*            #include <Menus.h>                                    */
  48. /*    #include <TextEdit.h>                                        */
  49.  
  50. #ifdef __cplusplus
  51. extern "C" {
  52. #endif
  53.  
  54. #if GENERATINGPOWERPC
  55. #pragma options align=mac68k
  56. #endif
  57.  
  58. #ifdef __CFM68K__
  59. #pragma lib_export on
  60. #endif
  61.  
  62.  
  63. enum {
  64. /* resource types  */
  65.     rSectionType                = 'sect',                        /* ResType of saved SectionRecords */
  66. /* Finder types for edition files */
  67.     kPICTEditionFileType        = 'edtp',
  68.     kTEXTEditionFileType        = 'edtt',
  69.     ksndEditionFileType            = 'edts',
  70.     kUnknownEditionFileType        = 'edtu',
  71.     kPublisherDocAliasFormat    = 'alis',
  72.     kPreviewFormat                = 'prvw',
  73.     kFormatListFormat            = 'fmts'
  74. };
  75.  
  76. enum {
  77. /* section types */
  78.     stSubscriber                = 0x01,
  79.     stPublisher                    = 0x0A,
  80.     sumAutomatic                = 0,                            /* subscriber update mode - Automatically     */
  81.     sumManual                    = 1,                            /* subscriber update mode - Manually */
  82.     pumOnSave                    = 0,                            /* publisher update mode - OnSave            */
  83.     pumManual                    = 1,                            /* publisher update mode - Manually */
  84.     kPartsNotUsed                = 0,
  85.     kPartNumberUnknown            = -1,                            /* misc */
  86.     kPreviewWidth                = 120,
  87.     kPreviewHeight                = 120,
  88. /* bits for formatsMask */
  89.     kPICTformatMask                = 1,
  90.     kTEXTformatMask                = 2,
  91.     ksndFormatMask                = 4,
  92. /* pseudo-item hits for dialogHooks 
  93.  the first if for NewPublisher or NewSubscriber Dialogs */
  94.     emHookRedrawPreview            = 150,
  95. /* the following are for SectionOptions Dialog */
  96.     emHookCancelSection            = 160,
  97.     emHookGoToPublisher            = 161,
  98.     emHookGetEditionNow            = 162,
  99.     emHookSendEditionNow        = 162,
  100.     emHookManualUpdateMode        = 163,
  101.     emHookAutoUpdateMode        = 164
  102. };
  103.  
  104. enum {
  105. /* the refcon field of the dialog record during a modalfilter 
  106.  or dialoghook contains one the following */
  107.     emOptionsDialogRefCon        = 'optn',
  108.     emCancelSectionDialogRefCon    = 'cncl',
  109.     emGoToPubErrDialogRefCon    = 'gerr',
  110.     kFormatLengthUnknown        = -1
  111. };
  112.  
  113. /* one byte, stSubscriber or stPublisher */
  114. typedef SignedByte SectionType;
  115.  
  116. /* seconds since 1904 */
  117. typedef unsigned long TimeStamp;
  118.  
  119. /* similar to ResType */
  120. typedef FourCharCode FormatType;
  121.  
  122. /* used in Edition I/O */
  123. typedef Handle EditionRefNum;
  124.  
  125. /* update modes */
  126. /* sumAutomatic, pumSuspend, etc */
  127. typedef short UpdateMode;
  128.  
  129. typedef struct SectionRecord SectionRecord;
  130.  
  131. typedef SectionRecord *SectionPtr, **SectionHandle;
  132.  
  133. struct SectionRecord {
  134.     SignedByte                        version;                    /* always 0x01 in system 7.0 */
  135.     SectionType                        kind;                        /* stSubscriber or stPublisher */
  136.     UpdateMode                        mode;                        /* auto or manual */
  137.     TimeStamp                        mdDate;                        /* last change in document */
  138.     long                            sectionID;                    /* app. specific, unique per document */
  139.     long                            refCon;                        /* application specific */
  140.     AliasHandle                        alias;                        /* handle to Alias Record */
  141.     long                            subPart;                    /* which part of container file */
  142.     SectionHandle                    nextSection;                /* for linked list of app's Sections */
  143.     Handle                            controlBlock;                /* used internally */
  144.     EditionRefNum                    refNum;                        /* used internally */
  145. };
  146. struct EditionContainerSpec {
  147.     FSSpec                            theFile;
  148.     ScriptCode                        theFileScript;
  149.     long                            thePart;
  150.     Str31                            thePartName;
  151.     ScriptCode                        thePartScript;
  152. };
  153. typedef struct EditionContainerSpec EditionContainerSpec;
  154.  
  155. typedef EditionContainerSpec *EditionContainerSpecPtr;
  156.  
  157. struct EditionInfoRecord {
  158.     TimeStamp                        crDate;                        /* date EditionContainer was created */
  159.     TimeStamp                        mdDate;                        /* date of last change */
  160.     OSType                            fdCreator;                    /* file creator */
  161.     OSType                            fdType;                        /* file type */
  162.     EditionContainerSpec            container;                    /* the Edition */
  163. };
  164. typedef struct EditionInfoRecord EditionInfoRecord;
  165.  
  166. struct NewPublisherReply {
  167.     Boolean                            canceled;                    /* O */
  168.     Boolean                            replacing;
  169.     Boolean                            usePart;                    /* I */
  170.     SInt8                            filler;
  171.     Handle                            preview;                    /* I */
  172.     FormatType                        previewFormat;                /* I */
  173.     EditionContainerSpec            container;                    /* I/O */
  174. };
  175. typedef struct NewPublisherReply NewPublisherReply;
  176.  
  177. struct NewSubscriberReply {
  178.     Boolean                            canceled;                    /* O */
  179.     SignedByte                        formatsMask;
  180.     EditionContainerSpec            container;                    /*I/O*/
  181. };
  182. typedef struct NewSubscriberReply NewSubscriberReply;
  183.  
  184. struct SectionOptionsReply {
  185.     Boolean                            canceled;                    /* O */
  186.     Boolean                            changed;                    /* O */
  187.     SectionHandle                    sectionH;                    /* I */
  188.     ResType                            action;                        /* O */
  189. };
  190. typedef struct SectionOptionsReply SectionOptionsReply;
  191.  
  192. typedef pascal Boolean (*ExpModalFilterProcPtr)(DialogPtr theDialog, EventRecord *theEvent, short itemOffset, short *itemHit, Ptr yourDataPtr);
  193. typedef pascal short (*ExpDlgHookProcPtr)(short itemOffset, short itemHit, DialogPtr theDialog, Ptr yourDataPtr);
  194.  
  195. #if GENERATINGCFM
  196. typedef UniversalProcPtr ExpModalFilterUPP;
  197. typedef UniversalProcPtr ExpDlgHookUPP;
  198. #else
  199. typedef ExpModalFilterProcPtr ExpModalFilterUPP;
  200. typedef ExpDlgHookProcPtr ExpDlgHookUPP;
  201. #endif
  202.  
  203. enum {
  204.     uppExpModalFilterProcInfo = kPascalStackBased
  205.          | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  206.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(DialogPtr)))
  207.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(EventRecord*)))
  208.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(short)))
  209.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(short*)))
  210.          | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(Ptr))),
  211.     uppExpDlgHookProcInfo = kPascalStackBased
  212.          | RESULT_SIZE(SIZE_CODE(sizeof(short)))
  213.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(short)))
  214.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(short)))
  215.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(DialogPtr)))
  216.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(Ptr)))
  217. };
  218.  
  219. #if GENERATINGCFM
  220. #define NewExpModalFilterProc(userRoutine)        \
  221.         (ExpModalFilterUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppExpModalFilterProcInfo, GetCurrentArchitecture())
  222. #define NewExpDlgHookProc(userRoutine)        \
  223.         (ExpDlgHookUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppExpDlgHookProcInfo, GetCurrentArchitecture())
  224. #else
  225. #define NewExpModalFilterProc(userRoutine)        \
  226.         ((ExpModalFilterUPP) (userRoutine))
  227. #define NewExpDlgHookProc(userRoutine)        \
  228.         ((ExpDlgHookUPP) (userRoutine))
  229. #endif
  230.  
  231. #if GENERATINGCFM
  232. #define CallExpModalFilterProc(userRoutine, theDialog, theEvent, itemOffset, itemHit, yourDataPtr)        \
  233.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppExpModalFilterProcInfo, (theDialog), (theEvent), (itemOffset), (itemHit), (yourDataPtr))
  234. #define CallExpDlgHookProc(userRoutine, itemOffset, itemHit, theDialog, yourDataPtr)        \
  235.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppExpDlgHookProcInfo, (itemOffset), (itemHit), (theDialog), (yourDataPtr))
  236. #else
  237. #define CallExpModalFilterProc(userRoutine, theDialog, theEvent, itemOffset, itemHit, yourDataPtr)        \
  238.         (*(userRoutine))((theDialog), (theEvent), (itemOffset), (itemHit), (yourDataPtr))
  239. #define CallExpDlgHookProc(userRoutine, itemOffset, itemHit, theDialog, yourDataPtr)        \
  240.         (*(userRoutine))((itemOffset), (itemHit), (theDialog), (yourDataPtr))
  241. #endif
  242.  
  243.  
  244. enum {
  245.     ioHasFormat,
  246.     ioReadFormat,
  247.     ioNewFormat,
  248.     ioWriteFormat
  249. };
  250.  
  251. typedef SignedByte FormatIOVerb;
  252.  
  253.  
  254. enum {
  255.     eoOpen,
  256.     eoClose,
  257.     eoOpenNew,
  258.     eoCloseNew,
  259.     eoCanSubscribe
  260. };
  261.  
  262. typedef SignedByte EditionOpenerVerb;
  263.  
  264. struct FormatIOParamBlock {
  265.     long                            ioRefNum;
  266.     FormatType                        format;
  267.     long                            formatIndex;
  268.     unsigned long                    offset;
  269.     Ptr                                buffPtr;
  270.     unsigned long                    buffLen;
  271. };
  272. typedef struct FormatIOParamBlock FormatIOParamBlock;
  273.  
  274. typedef struct EditionOpenerParamBlock EditionOpenerParamBlock;
  275.  
  276. typedef pascal short (*FormatIOProcPtr)(FormatIOVerb selector, FormatIOParamBlock *PB);
  277. typedef pascal short (*EditionOpenerProcPtr)(EditionOpenerVerb selector, EditionOpenerParamBlock *PB);
  278.  
  279. #if GENERATINGCFM
  280. typedef UniversalProcPtr FormatIOUPP;
  281. typedef UniversalProcPtr EditionOpenerUPP;
  282. #else
  283. typedef FormatIOProcPtr FormatIOUPP;
  284. typedef EditionOpenerProcPtr EditionOpenerUPP;
  285. #endif
  286.  
  287. struct EditionOpenerParamBlock {
  288.     EditionInfoRecord                info;
  289.     SectionHandle                    sectionH;
  290.     const FSSpec                    *document;
  291.     OSType                            fdCreator;
  292.     long                            ioRefNum;
  293.     FormatIOUPP                        ioProc;
  294.     Boolean                            success;
  295.     SignedByte                        formatsMask;
  296. };
  297. enum {
  298.     uppFormatIOProcInfo = kPascalStackBased
  299.          | RESULT_SIZE(SIZE_CODE(sizeof(short)))
  300.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(FormatIOVerb)))
  301.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(FormatIOParamBlock*))),
  302.     uppEditionOpenerProcInfo = kPascalStackBased
  303.          | RESULT_SIZE(SIZE_CODE(sizeof(short)))
  304.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(EditionOpenerVerb)))
  305.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(EditionOpenerParamBlock*)))
  306. };
  307.  
  308. #if GENERATINGCFM
  309. #define NewFormatIOProc(userRoutine)        \
  310.         (FormatIOUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppFormatIOProcInfo, GetCurrentArchitecture())
  311. #define NewEditionOpenerProc(userRoutine)        \
  312.         (EditionOpenerUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppEditionOpenerProcInfo, GetCurrentArchitecture())
  313. #else
  314. #define NewFormatIOProc(userRoutine)        \
  315.         ((FormatIOUPP) (userRoutine))
  316. #define NewEditionOpenerProc(userRoutine)        \
  317.         ((EditionOpenerUPP) (userRoutine))
  318. #endif
  319.  
  320.  
  321. enum {
  322.     sectionEventMsgClass        = 'sect',
  323.     sectionReadMsgID            = 'read',
  324.     sectionWriteMsgID            = 'writ',
  325.     sectionScrollMsgID            = 'scrl',
  326.     sectionCancelMsgID            = 'cncl'
  327. };
  328.  
  329. enum {
  330.     currentEditionMgrVers        = 0x0011
  331. };
  332.  
  333. #if !CFMSYSTEMCALLS
  334. extern pascal OSErr InitEditionPack(void)
  335.  FIVEWORDINLINE(0x3F3C, 0x0011, 0x303C, 0x0100, 0xA82D);
  336. #else
  337. #define InitEditionPack() InitEditionPackVersion(currentEditionMgrVers)
  338. extern pascal OSErr InitEditionPackVersion(short curEditionMgrVers)
  339.  THREEWORDINLINE(0x303C, 0x0100, 0xA82D);
  340. #endif
  341. extern pascal OSErr NewSection(const EditionContainerSpec *container, ConstFSSpecPtr sectionDocument, SectionType kind, long sectionID, UpdateMode initalMode, SectionHandle *sectionH)
  342.  THREEWORDINLINE(0x303C, 0x0A02, 0xA82D);
  343. extern pascal OSErr RegisterSection(const FSSpec *sectionDocument, SectionHandle sectionH, Boolean *aliasWasUpdated)
  344.  THREEWORDINLINE(0x303C, 0x0604, 0xA82D);
  345. extern pascal OSErr UnRegisterSection(SectionHandle sectionH)
  346.  THREEWORDINLINE(0x303C, 0x0206, 0xA82D);
  347. extern pascal OSErr IsRegisteredSection(SectionHandle sectionH)
  348.  THREEWORDINLINE(0x303C, 0x0208, 0xA82D);
  349. extern pascal OSErr AssociateSection(SectionHandle sectionH, const FSSpec *newSectionDocument)
  350.  THREEWORDINLINE(0x303C, 0x040C, 0xA82D);
  351. extern pascal OSErr CreateEditionContainerFile(const FSSpec *editionFile, OSType fdCreator, ScriptCode editionFileNameScript)
  352.  THREEWORDINLINE(0x303C, 0x050E, 0xA82D);
  353. extern pascal OSErr DeleteEditionContainerFile(const FSSpec *editionFile)
  354.  THREEWORDINLINE(0x303C, 0x0210, 0xA82D);
  355. extern pascal OSErr OpenEdition(SectionHandle subscriberSectionH, EditionRefNum *refNum)
  356.  THREEWORDINLINE(0x303C, 0x0412, 0xA82D);
  357. extern pascal OSErr OpenNewEdition(SectionHandle publisherSectionH, OSType fdCreator, ConstFSSpecPtr publisherSectionDocument, EditionRefNum *refNum)
  358.  THREEWORDINLINE(0x303C, 0x0814, 0xA82D);
  359. extern pascal OSErr CloseEdition(EditionRefNum whichEdition, Boolean successful)
  360.  THREEWORDINLINE(0x303C, 0x0316, 0xA82D);
  361. extern pascal OSErr EditionHasFormat(EditionRefNum whichEdition, FormatType whichFormat, Size *formatSize)
  362.  THREEWORDINLINE(0x303C, 0x0618, 0xA82D);
  363. extern pascal OSErr ReadEdition(EditionRefNum whichEdition, FormatType whichFormat, void *buffPtr, Size *buffLen)
  364.  THREEWORDINLINE(0x303C, 0x081A, 0xA82D);
  365. extern pascal OSErr WriteEdition(EditionRefNum whichEdition, FormatType whichFormat, const void *buffPtr, Size buffLen)
  366.  THREEWORDINLINE(0x303C, 0x081C, 0xA82D);
  367. extern pascal OSErr GetEditionFormatMark(EditionRefNum whichEdition, FormatType whichFormat, unsigned long *currentMark)
  368.  THREEWORDINLINE(0x303C, 0x061E, 0xA82D);
  369. extern pascal OSErr SetEditionFormatMark(EditionRefNum whichEdition, FormatType whichFormat, unsigned long setMarkTo)
  370.  THREEWORDINLINE(0x303C, 0x0620, 0xA82D);
  371. extern pascal OSErr GetEditionInfo(SectionHandle sectionH, EditionInfoRecord *editionInfo)
  372.  THREEWORDINLINE(0x303C, 0x0422, 0xA82D);
  373. extern pascal OSErr GoToPublisherSection(const EditionContainerSpec *container)
  374.  THREEWORDINLINE(0x303C, 0x0224, 0xA82D);
  375. extern pascal OSErr GetLastEditionContainerUsed(EditionContainerSpec *container)
  376.  THREEWORDINLINE(0x303C, 0x0226, 0xA82D);
  377. extern pascal OSErr GetStandardFormats(const EditionContainerSpec *container, FormatType *previewFormat, Handle preview, Handle publisherAlias, Handle formats)
  378.  THREEWORDINLINE(0x303C, 0x0A28, 0xA82D);
  379. extern pascal OSErr GetEditionOpenerProc(EditionOpenerUPP *opener)
  380.  THREEWORDINLINE(0x303C, 0x022A, 0xA82D);
  381. extern pascal OSErr SetEditionOpenerProc(EditionOpenerUPP opener)
  382.  THREEWORDINLINE(0x303C, 0x022C, 0xA82D);
  383. extern pascal OSErr CallEditionOpenerProc(EditionOpenerVerb selector, EditionOpenerParamBlock *PB, EditionOpenerUPP routine)
  384.  THREEWORDINLINE(0x303C, 0x052E, 0xA82D);
  385. extern pascal OSErr CallFormatIOProc(FormatIOVerb selector, FormatIOParamBlock *PB, FormatIOUPP routine)
  386.  THREEWORDINLINE(0x303C, 0x0530, 0xA82D);
  387. extern pascal OSErr NewSubscriberDialog(NewSubscriberReply *reply)
  388.  THREEWORDINLINE(0x303C, 0x0232, 0xA82D);
  389. extern pascal OSErr NewSubscriberExpDialog(NewSubscriberReply *reply, Point where, short expansionDITLresID, ExpDlgHookUPP dlgHook, ExpModalFilterUPP filter, void *yourDataPtr)
  390.  THREEWORDINLINE(0x303C, 0x0B34, 0xA82D);
  391. extern pascal OSErr NewPublisherDialog(NewPublisherReply *reply)
  392.  THREEWORDINLINE(0x303C, 0x0236, 0xA82D);
  393. extern pascal OSErr NewPublisherExpDialog(NewPublisherReply *reply, Point where, short expansionDITLresID, ExpDlgHookUPP dlgHook, ExpModalFilterUPP filter, void *yourDataPtr)
  394.  THREEWORDINLINE(0x303C, 0x0B38, 0xA82D);
  395. extern pascal OSErr SectionOptionsDialog(SectionOptionsReply *reply)
  396.  THREEWORDINLINE(0x303C, 0x023A, 0xA82D);
  397. extern pascal OSErr SectionOptionsExpDialog(SectionOptionsReply *reply, Point where, short expansionDITLresID, ExpDlgHookUPP dlgHook, ExpModalFilterUPP filter, void *yourDataPtr)
  398.  THREEWORDINLINE(0x303C, 0x0B3C, 0xA82D);
  399.  
  400. #ifdef __CFM68K__
  401. #pragma lib_export off
  402. #endif
  403.  
  404. #if GENERATINGPOWERPC
  405. #pragma options align=reset
  406. #endif
  407.  
  408. #ifdef __cplusplus
  409. }
  410. #endif
  411.  
  412. #endif /* __EDITIONS__ */
  413.